Often, a program written in an object-oriented language of one object model, such as Java, desires to call objects of another object model, such as Common Object Model (COM) objects. In order to call COM objects, a typelib of COM interfaces is transformed into a set of Java source code that defines stub classes that indirectly call a small set of native methods, which in turn call the desired COM interfaces. In particular, a Java class is generated for each interface defined in the COM typelib. Each generated class provides a callable and type-checked interface for user Java code to invoke; encapsulates the method number required for the COM call; marshals the Java arguments into a form usable by the native code; and unmarshals the return value into the return type expected by the Java caller.
Since a Java class is generated for each interface defined in the COM typelib and the COM typelib is sometimes large (e.g., thousands of interfaces), a large amount of Java object code is sometimes generated. Thus, a large amount of space is sometimes needed for the generated Java object code.
Based on the foregoing, a need exists for a capability that enables the amount of object code generated and used to call objects of one object model from object-oriented programs of another object model to be reduced. A further need exists for decreasing the size of the generated object code without sacrificing certain advantages of generated code, such as the availability of type-checking at compilation time.